package com.ncucoder.demo.service;

import com.ncucoder.demo.model.Customer;

import java.util.List;

/**
 *
 *
 * @author <a href="https://edit.ncucoder.com">hsowan</a>
 * @since 2018-12-23 03:28
 */
public interface CustomerService {

    /**
     * select one customer by id
     *
     * @param id primary key
     * @return com.ncucoder.demo.model.Customer
     */
    Customer getCustomerById(Long id);

    /**
     * select all of customers
     *
     * @param page current page index
     * @param size how many to show
     * @return java.util.List
     */
    List<Customer> listCustomers(int page, int size);

    /**
     * insert one customer
     *
     * @param customer com.ncucoder.demo.model.Customer
     * @return if insert return 1, or return 0
     */
    int saveCustomer(Customer customer);

    /**
     * delete one customer by id
     *
     * @param id primary key
     * @return the id of customer deleted, fail return 0
     */
    int deleteCustomerById(Long id);

    /**
     * update customer
     *
     * @param customer com.ncucoder.demo.model.Customer
     * @return the id of customer updated, fail return 0
     */
    int updateCustomer(Customer customer);

    /**
     *
     * @return
     */
    int count();
}
